package com.hullbreach.rogue;

import java.util.ArrayList;
import java.util.List;

public class GameManager {
	
	/* Since this class is a singleton, we must declare an instance
	 * of this class within itself. The singleton will be instantiated
	 * a single time during the course of an application's full life-cycle
	 */
	private static GameManager INSTANCE;
	
	
	/* The game manager should keep track of certain data involved in
	 * our game. */

	//Scheduler for entities
	private Scheduler scheduler;
	
	//object array of anything that needs to tracked by time
	// game should loop through these entities each round
	public List<Object> mEntityList = new ArrayList<Object>();
	
	//current game
	//public Map mMap = new Map(null);
	
	//game level position tiles
	public int[] mStartTileLoc = {0,0};
	public int[] mExitTileLoc = {0,0};
	public int[] mEngineTileLoc = {0,0};
	public int[] mBridgeTileLoc = {0,0};
	public int[] mTeleTileLoc = {0,0};
	public int[] mArmouryTileLoc = {0,0};
	
	//general data
	public boolean mPlayerTurn = false;
	public int mTimePerTurn = 60;
	public int mTimeTotal = 0;
	public int mTimeSeconds = 0;
	public int mTimeMinutes = 0;
	public int mTimeHours = 0;
	
	
	
	// The constructor does not do anything for this singleton
	GameManager(){
	}
	
	/* For a singleton class, we must have some method which provides
	 * access to the class instance. getInstance is a static method,
	 * which means we can access it globally (within other classes).
	 * If the GameManager has not yet been instantiated, we create a 
	 * new one.
	 */
	public static GameManager getInstance(){
		if(INSTANCE == null){
			INSTANCE = new GameManager();
		}
		return INSTANCE;
	}

	// Resetting the game simply means we must revert back to initial values.
	public void resetGame(){
		//game level position tiles
		mStartTileLoc = new int[]{0,0};
		mExitTileLoc = new int[]{0,0};
		mEngineTileLoc = new int[]{0,0};
		mBridgeTileLoc = new int[]{0,0};
		mTeleTileLoc = new int[]{0,0};
		mArmouryTileLoc = new int[]{0,0};
		
		//reset time and turn data
		mPlayerTurn = false;
		mTimePerTurn = 60;
		mTimeTotal = 0;
		mTimeSeconds = 0;
		mTimeMinutes = 0;
		mTimeHours = 0;
	}
	
	public Scheduler getScheduler() {
		return scheduler;
	}
	public void setScheduler(Scheduler scheduler) {
		this.scheduler = scheduler;
	}
	
	/*
	public Map getMap() {
		return mMap;
	}
	public void setMap(Map map) {
		this.mMap = map;
	}
	*/	
	
}